package com.itheima.controller;

import com.alibaba.dubbo.config.annotation.Reference;
import com.itehima.service.CheckItemService;
import com.itheima.constant.MessageConstant;
import com.itheima.entity.Result;
import com.itheima.pojo.CheckItem;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author djl
 * @version 1.0
 * @date 2020/3/10 23:35
 */
@RestController
@RequestMapping(value = {"/checkItem"})
public class CheckItemCintroller {


    @Reference
    private CheckItemService checkItemService;

    /**
     * 新增检查项
     * @param checkItem
     * @return
     */
    @RequestMapping(value = {"/add"})
    public Result addCheckItem(@RequestBody CheckItem checkItem){
        try {
            checkItemService.addCheckItem(checkItem);
        }catch (Exception ex){
            return new Result(true,MessageConstant.ADD_CHECKITEM_SUCCESS);
        }
        return new Result(false,MessageConstant.ADD_CHECKITEM_FAIL);
    }
}
